<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>排序</title>
<script>
var x=null;
var listObj=null;
//鼠标按下不放时的操作
function setTimeStart(type)
{
listObj=document.getElementById('forder');
//超过0.3秒启动连续的向上(下)的操作
if(type=="up")
{
x=setTimeout(upListItem,300);
}else
{
x=setTimeout(downListItem,300);
}
}
//将选中item向上
function upListItem()
{
var selIndex=listObj.selectedIndex;
if(selIndex<0)
{
if(x!=null){clearTimeout(x);}
alert("请先选中一项！");
return;
}
if(selIndex==0)
{
if(x!=null){clearTimeout(x);}
//alert("已经移到第一位！");
return;
}var selValue=listObj.options[selIndex].value;
var selText=listObj.options[selIndex].text;
listObj.options[selIndex].value=listObj.options[selIndex-1].value;
listObj.options[selIndex].text=listObj.options[selIndex-1].text;
listObj.options[selIndex-1].value=selValue;
listObj.options[selIndex-1].text=selText;
listObj.selectedIndex=selIndex-1;
if(selIndex+1>0)
{
x=setTimeout(upListItem,200)
}
}
//将选中item向下
function downListItem()
{
var selIndex=listObj.selectedIndex;
if(selIndex<0)
{
if(x!=null){clearTimeout(x);}
alert("请先选中一项！");
return;
}
if(selIndex==listObj.options.length-1)
{
if(x!=null){clearTimeout(x);}
//alert("已经移到最后一位！");
return;
}var selValue=listObj.options[selIndex].value;
var selText=listObj.options[selIndex].text;
listObj.options[selIndex].value=listObj.options[selIndex+1].value;
listObj.options[selIndex].text=listObj.options[selIndex+1].text;
listObj.options[selIndex+1].value=selValue;
listObj.options[selIndex+1].text=selText;
listObj.selectedIndex=selIndex+1;
if(selIndex+1<listObj.options.length-1)
{
x=setTimeout(downListItem,200)
}
}
</script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body topMargin="20px" leftMargin="10px" rightMargin="0">
<TABLE id="Table1" height="100%" cellSpacing="0" cellPadding="0" width="100%" border="0">
    <TR>
        <TD vAlign="top"><TABLE id="Table4" cellSpacing="0" cellPadding="0" width="100%" border="0">
                <TR>
                    <TD><INPUT class="upBtn" type="button" value="向上↑" onMouseDown="setTimeStart('up');" onMouseUp="clearTimeout(x);"
onclick="upListItem();clearTimeout(x);" ID="Button1" NAME="Button1">
                        <INPUT style="WIDTH: 48px; HEIGHT: 22px" type="button" value="↓向下" class="downBtn" onMouseDown="setTimeStart('down');"
onmouseup="clearTimeout(x);" onClick="downListItem();clearTimeout(x);" ID="Button2" NAME="Button2"></TD>
                </TR>
                <TR>
                    <TD><SELECT id="forder" style="WIDTH: 304px; HEIGHT: 240px" size="15">
                            <OPTION value=1>1</OPTION>
                            <OPTION value=2>2</OPTION>
                            <OPTION value=3>3</OPTION>
                            <OPTION value=4>4</OPTION>
                            <OPTION value=5>5</OPTION>
                            <OPTION value=6>6</OPTION>
                            <OPTION value=7>7</OPTION>
                            <OPTION value=8>8</OPTION>
                            <OPTION value=9>9</OPTION>
                        </SELECT></TD>
                </TR>
            </TABLE></TD>
    </TR>
</TABLE>
</body>
</html>